package com.gang.mars.basic.collection;

import java.lang.reflect.Method;
import java.sql.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * @author gang.chen
 * @description
 * @Date 2021/11/2 14:25
 */
public class Peach001 {

    public static void main(String[] args) {

        final ConcurrentMap<String, List<Peach002>> factoryMethodCandidateCache = new ConcurrentHashMap<>();
        List<Peach002> peach002 = factoryMethodCandidateCache.computeIfAbsent("1000", id -> getUnique(id));

        System.out.println(peach002);
    }

    public static List<Peach002> getUnique(String id){
        List<Peach002> list = new ArrayList<>();
        Peach002 peach002 = new Peach002(id);
        list.add(peach002);
        return list;
    }

    static class Peach002{
        String id;
        public Peach002(String id) {
            this.id = id;
        }
    }
}
